package com.black.utils.file.compress.jar.entity;

import lombok.Getter;
import lombok.Setter;
import org.objectweb.asm.Opcodes;
import org.objectweb.asm.Type;

/**
 * @author ylx
 */
@Getter
@Setter
public class MethodInfo extends JavaInfo {
    private String[] exceptions;
    private Type[] argumentTypes;
    private Type returnType;

    public MethodInfo(String name) {
        this(Opcodes.ACC_PUBLIC, name, "()V", null, null);
    }

    public MethodInfo(int access, String name, String desc, String signature, String[] exceptions) {
        super(name);
        this.access = access;
        this.desc = desc;
        this.signature = signature;
        this.exceptions = exceptions;
        Type methodType = Type.getMethodType(desc);
        this.argumentTypes = methodType.getArgumentTypes();
        this.returnType = methodType.getReturnType();
    }
}
